﻿<?php
/*********************************************************************\
* This File is a part of BH-PANEL (Breizh-Heberg Panel v2.1)
* Copyright (C) 2008-2009 the BH Developpers : Vincent Giersch <mail@vincordi.fr>, Cyprien Laleau <fanning.fr@gmail.com> and Edwin Cabiten <marmottes44@hotmail.fr>
* See file AUTHORS to get more informations

* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.

* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
/*********************************************************************/

if($_SESSION['u_auth'] > 7) {
	
	$req_maint = query("SELECT * FROM maintenance ORDER BY id DESC");
	
	$title = "Gestion des maintenances";
	$tplinc = "admin-maintenance";
	$parse = 1;
	
	$tpl->assign(array('error' => 0));
	
	if (($nb_maint = mysql_num_rows($req_maint)) > 0) {
		
		$etat_array = array('1' => 'Annuler',
						'2' => 'En cours',
						'3' => 'En pause',
						'4' => 'Terminé',
						);
		
		while($result_maint = mysql_fetch_array($req_maint)) {
			
			$etat = $result_maint['etat'];
			
			$tpl->assign_array('list_maint', array( 'id' => $result_maint['id'],
													'etat' => $etat_array[$etat],
													'date' => $result_maint['date_ouvert'],
													'titre' => $result_maint['titre'],
													));
													
		}
		
		$tpl->assign(array('nb_maint' => $nb_maint));
	}
	else
		$tpl->assign(array('nb_maint' => 0));
		
}
else
	header ("LOCATION : /site/index.html");
?>